/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package assignment_cp3120.ucm;

import assignment_cp3120.DAO.Factory.DAOFactory;
import assignment_cp3120.DAO.mysqlDAO.MysqlDA0Factory;
import assignment_cp3120.login.LoginModel;
import assignment_cp3120.login.LoginView;
import assignment_cp3120.user.registeruser.RegisterUserModel;
import assignment_cp3120.user.registeruser.RegisterUserView;
import assignment_cp3120.startup.StartupModel;
import assignment_cp3120.startup.StartupView;
import assignment_cp3120.viewtickets.ViewTicketsModel;
import assignment_cp3120.viewtickets.ViewTicketsView;
import java.awt.event.ActionEvent;

/**
 * 
 * START-UP USE-CASE 
 * 
 * Precondition: NULL
 * This is the use case that controlls the entire program.
 * <P>
 * 1. System shows welcome screen.
 * 2. User presses purchase ticket
 * 3. System shows purchase screen
 * 4. System runs purchase Use Case
 * <P>
 * 2.a.1. User presses Login
 * 2.a.2. System show Login screen
 * 2.a.3. System runs login Use Case
 * <P>
 * 2.b.1. User presses register
 * 2.b.2. System displays register screen
 * 2.b.2. System runs register Use Case
 * <P>
 * a.1 Users presses exit
 * a.2 System exits program
 * 
 * Postcondition: Startup screen is displayed 
 * @author Richard Irons
 */
public class UCStartup implements UseCaseController{
    private StartupView view;
    private StartupModel model;
    
    private LoginModel loginModel;
    private LoginView loginView;
    private UCLoginUser login;
    
    private RegisterUserModel registerModel;
    private RegisterUserView registerUserView;
    private UCRegisterUser registerUser;
    
    private ViewTicketsModel viewTicketsModel;
    private ViewTicketsView viewTicketsView;
    private UCViewTickets viewTickets;
    /**
     * Default constructor
     * Calls Constructor(view,model) with new views and models.
     */
    public UCStartup(){
        this(StartupView.getInstance(), new StartupModel());
    }
    /**
     * Constructor for the startup uc. Sets the view and model to inputs
     * @param view
     * @param model
     */
    public UCStartup(StartupView view, StartupModel model) {
        initialization();
        this.view = view;
        this.model = model;
    }
    /**
     * Starts the UC and shows the GUI. This is the only way to show the entire program
     */
    public void run() {        
        view.showGUI();
    }
    /**
     * Initialize the DAOFactory
     * Sets the DAOFactory to a mysql factory
     */
    public void initialization(){
        DAOFactory.setFactory(new MysqlDA0Factory());
    } 
}
